#include "Main.h"
#include "Input.h"
#include "Draw.h"

All::Random random;
All::Input input;
All::Draw draw;

double All::Random::Timer (double BeginTime) {
	double EllepsedTime = clock() - BeginTime;
	return EllepsedTime;
}

void All::Random::writeLog (double LogStuff) {
	logfile << "Time taken (in miliseconds):\t" << LogStuff << "\n";
}

void All::Random::Initialize() {
	glClearColor(0.25, 0.25, 0.25, 0.0);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}

void Draw() {
	draw.Line(0.45f, 0.55f);
}

void key_handler(unsigned char key, int x, int y) {
	input.keyboard_input(key, x, y);
}

void mouse_handler(int button, int state, int x, int y) {
	input.mouse_input(button, state, x, y);
}


int main(int argc, char** argv) {
	double TimeNow = clock();
	draw.first = true;
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
	glutInitWindowSize(600, 400);
	glutInitWindowPosition(100, 100);
	glutCreateWindow("Test");
	cout << "Scherm is er: " << random.Timer (TimeNow) << endl;
	random.Initialize();
	glutDisplayFunc(Draw);
	glutKeyboardFunc(key_handler);
	glutMouseFunc(mouse_handler);
	glutMainLoop();
	return 0;
}